package com.test.spring.fusion.service.impl;

import java.util.UUID;

import org.spring.boot.fusion.common.tools.IdTool;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.test.spring.fusion.domain.Producers;
import com.test.spring.fusion.mapper.ProducersMapper;
import com.test.spring.fusion.service.ProducersService;

@Service
public class ProducersServiceImpl extends ServiceImpl<ProducersMapper, Producers> implements ProducersService {

	@Override
	public void saveProducers() {
		Producers producers = new Producers();
		producers.setId(IdTool.IDLONG());
		producers.setUsername(UUID.randomUUID().toString());
		this.save(producers);
	}

	@Transactional(rollbackFor = Exception.class)
	@Override
	public void local() {
		Producers producers = new Producers();
		producers.setId(IdTool.IDLONG());
		producers.setUsername(UUID.randomUUID().toString());
		this.save(producers);
		System.out.println(10/0);
	}
	
}
